package com.demo.crm;

import com.demo.crm.entity.TAuthor;
import com.demo.crm.service.TestService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 测试控制器
 *
 * @author zhangmz
 * @create 17/4/22
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private TestService testService;

    @RequestMapping(method = RequestMethod.GET)
    public String test() {
        return "hello world!";
    }

    @RequestMapping("/service")
    public String testService(){
        return this.testService.hello();
    }

    @RequestMapping("/mapper")
    public TAuthor testMapper(){
        return this.testService.getAuthor(1L);
    }


    @RequestMapping("/list/{pageNum}")
    public List<TAuthor> list(@PathVariable Integer pageNum){
        Integer pageSize = 1;
        return this.testService.findList(pageNum,pageSize);
    }



}
